
      
<h1 class="mume-header" id="%E4%BC%98%E7%A7%80%E7%9A%84markdown%E5%BC%95%E6%93%8E-mume">&#x4F18;&#x79C0;&#x7684;Markdown&#x5F15;&#x64CE;-MUME</h1>

<blockquote>
<p>&#x56E0;&#x9879;&#x76EE;&#x9700;&#x8981;&#xFF0C;&#x5C1D;&#x8BD5;&#x4E86;[markdown.js]&#x548C;[GitHub&#x7684;Markdown Web API]&#xFF0C;&#x90FD;&#x4E0D;&#x5C3D;&#x5982;&#x4EBA;&#x610F;&#xFF0C;&#x4E8E;&#x662F;&#x5C06;&#x76EE;&#x6807;&#x5BF9;&#x51C6;&#x4E86;&#x5927;&#x540D;&#x9F0E;&#x9F0E;Markdown Preview Enhanced&#x63D2;&#x4EF6;&#xFF0C;&#x7FFB;&#x5176;&#x6E90;&#x7801;&#xFF0C;&#x6700;&#x7EC8;&#x6316;&#x51FA;&#x7684;&#x80CC;&#x540E;&#x529F;&#x81E3;MUME&#x3002;&#x5982;&#x6B64;&#x4F18;&#x79C0;&#x7684;Markdown&#x5F15;&#x64CE;&#xFF0C;&#x5176;&#x5728;GitHub&#x4E0A;&#x7684;Star&#x4EC5;&#x6709;83&#x4E2A;&#xFF0C;&#x7740;&#x5B9E;&#x8BA9;&#x4EBA;&#x610F;&#x5916;&#x3002;</p>
</blockquote>
<h2 class="mume-header" id="%E8%B0%83%E7%94%A8%E7%AE%80%E5%8D%95">&#x8C03;&#x7528;&#x7B80;&#x5355;</h2>

<p>&#x4EE5;&#x5BFC;&#x51FA;&#x4E3A;html&#x4E3A;&#x4F8B;&#xFF1A;</p>
<pre data-role="codeBlock" data-info="javascript" class="language-javascript"><span class="token comment">//&#x5F15;&#x5165;</span>
<span class="token keyword">const</span> mume <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&quot;@shd101wyy/mume&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

<span class="token keyword">async</span> <span class="token keyword">function</span> <span class="token function">main</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token comment">// &#x521D;&#x59CB;&#x5316;</span>
  <span class="token keyword">await</span> mume<span class="token punctuation">.</span><span class="token function">init</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  
  <span class="token comment">// &#x521B;&#x5EFA;Markdown Engine&#x5B9E;&#x4F8B;</span>
  <span class="token keyword">const</span> engine <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">mume<span class="token punctuation">.</span>MarkdownEngine</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
    filePath<span class="token punctuation">:</span> <span class="token string">&quot;/Users/wangyiyi/Desktop/markdown-example/test3.md&quot;</span><span class="token punctuation">,</span>
    config<span class="token punctuation">:</span> <span class="token punctuation">{</span>
      previewTheme<span class="token punctuation">:</span> <span class="token string">&quot;github-light.css&quot;</span><span class="token punctuation">,</span>
      codeBlockTheme<span class="token punctuation">:</span> <span class="token string">&quot;default.css&quot;</span><span class="token punctuation">,</span>
      printBackground<span class="token punctuation">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>
      enableScriptExecution<span class="token punctuation">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span> <span class="token comment">// &lt;= for running code chunks</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
  <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

  <span class="token comment">// &#x5BFC;&#x51FA;Markdown&#x4E3A;html&#x683C;&#x5F0F;</span>
  <span class="token keyword">await</span> engine<span class="token punctuation">.</span><span class="token function">htmlExport</span><span class="token punctuation">(</span><span class="token punctuation">{</span> offline<span class="token punctuation">:</span> <span class="token boolean">false</span><span class="token punctuation">,</span> runAllCodeChunks<span class="token punctuation">:</span> <span class="token boolean">true</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token function">main</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><p>&#x4E0A;&#x9762;&#x4EE3;&#x7801;&#x4E2D;&#x5B8C;&#x6210;&#x4E86;<strong>mume&#x7684;&#x5BFC;&#x5165;</strong>&#xFF0C;<strong>&#x521D;&#x59CB;&#x5316;</strong>&#xFF0C;<strong>&#x6E90;&#x6587;&#x4EF6;&#x6307;&#x5B9A;</strong>&#xFF0C;<strong>&#x76EE;&#x6807;&#x6837;&#x5F0F;&#x6307;&#x5B9A;</strong>&#x53CA;<strong>&#x5BFC;&#x51FA;</strong></p>
<h2 class="mume-header" id="%E5%8A%9F%E8%83%BD%E5%BC%BA%E5%A4%A7">&#x529F;&#x80FD;&#x5F3A;&#x5927;</h2>

<h4 class="mume-header" id="%E5%AF%BC%E5%87%BA%E5%A4%9A%E7%A7%8D%E6%A0%BC%E5%BC%8F">&#x5BFC;&#x51FA;&#x591A;&#x79CD;&#x683C;&#x5F0F;</h4>

<p>&#x5728;&#x5B98;&#x65B9;&#x793A;&#x4F8B;&#x4EE3;&#x7801;&#x4E2D;&#x53EF;&#x4EE5;&#x6E05;&#x6670;&#x7684;&#x770B;&#x5230;&#xFF1A;</p>
<pre data-role="codeBlock" data-info="javascript" class="language-javascript">  <span class="token comment">// open in browser</span>
  <span class="token keyword">await</span> engine<span class="token punctuation">.</span><span class="token function">openInBrowser</span><span class="token punctuation">(</span><span class="token punctuation">{</span> runAllCodeChunks<span class="token punctuation">:</span> <span class="token boolean">true</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

  <span class="token comment">// html export</span>
  <span class="token keyword">await</span> engine<span class="token punctuation">.</span><span class="token function">htmlExport</span><span class="token punctuation">(</span><span class="token punctuation">{</span> offline<span class="token punctuation">:</span> <span class="token boolean">false</span><span class="token punctuation">,</span> runAllCodeChunks<span class="token punctuation">:</span> <span class="token boolean">true</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

  <span class="token comment">// chrome (puppeteer) export</span>
  <span class="token keyword">await</span> engine<span class="token punctuation">.</span><span class="token function">chromeExport</span><span class="token punctuation">(</span><span class="token punctuation">{</span> fileType<span class="token punctuation">:</span> <span class="token string">&quot;pdf&quot;</span><span class="token punctuation">,</span> runAllCodeChunks<span class="token punctuation">:</span> <span class="token boolean">true</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// fileType = &apos;pdf&apos;|&apos;png&apos;|&apos;jpeg&apos;</span>

  <span class="token comment">// phantomjs export</span>
  <span class="token keyword">await</span> engine<span class="token punctuation">.</span><span class="token function">phantomjsExport</span><span class="token punctuation">(</span><span class="token punctuation">{</span> fileType<span class="token punctuation">:</span> <span class="token string">&quot;pdf&quot;</span><span class="token punctuation">,</span> runAllCodeChunks<span class="token punctuation">:</span> <span class="token boolean">true</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// fileType = &apos;pdf&apos;|&apos;png&apos;|&apos;jpeg&apos;</span>

  <span class="token comment">// prince export</span>
  <span class="token keyword">await</span> engine<span class="token punctuation">.</span><span class="token function">princeExport</span><span class="token punctuation">(</span><span class="token punctuation">{</span> runAllCodeChunks<span class="token punctuation">:</span> <span class="token boolean">true</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

  <span class="token comment">// ebook export</span>
  <span class="token keyword">await</span> engine<span class="token punctuation">.</span><span class="token function">eBookExport</span><span class="token punctuation">(</span><span class="token punctuation">{</span> fileType<span class="token punctuation">:</span> <span class="token string">&quot;epub&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// fileType=`epub`|`pdf`|`mobi`|`html`</span>

  <span class="token comment">// pandoc export</span>
  <span class="token keyword">await</span> engine<span class="token punctuation">.</span><span class="token function">pandocExport</span><span class="token punctuation">(</span><span class="token punctuation">{</span> runAllCodeChunks<span class="token punctuation">:</span> <span class="token boolean">true</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

  <span class="token comment">// markdown(gfm) export</span>
  <span class="token keyword">await</span> engine<span class="token punctuation">.</span><span class="token function">markdownExport</span><span class="token punctuation">(</span><span class="token punctuation">{</span> runAllCodeChunks<span class="token punctuation">:</span> <span class="token boolean">true</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><h4>&#x81EA;&#x5E26;&#x4E30;&#x5BCC;&#x6837;&#x5F0F;</h4>
<ul>
<li>&#x9884;&#x89C8;&#x6837;&#x5F0F;<pre data-role="codeBlock" data-info="javascript" class="language-javascript">previewTheme<span class="token punctuation">:</span> <span class="token string">&apos;github-light.css&apos;</span><span class="token punctuation">,</span>
<span class="token comment">// &quot;atom-dark.css&quot;,</span>
<span class="token comment">// &quot;atom-light.css&quot;,</span>
<span class="token comment">// &quot;atom-material.css&quot;,</span>
<span class="token comment">// &quot;github-dark.css&quot;,</span>
<span class="token comment">// &quot;github-light.css&quot;,</span>
<span class="token comment">// &quot;gothic.css&quot;,</span>
<span class="token comment">// &quot;medium.css&quot;,</span>
<span class="token comment">// &quot;monokai.css&quot;,</span>
<span class="token comment">// &quot;newsprint.css&quot;,</span>
<span class="token comment">// &quot;night.css&quot;,</span>
<span class="token comment">// &quot;none.css&quot;,</span>
<span class="token comment">// &quot;one-dark.css&quot;,</span>
<span class="token comment">// &quot;one-light.css&quot;,</span>
<span class="token comment">// &quot;solarized-dark.css&quot;,</span>
<span class="token comment">// &quot;solarized-light.css&quot;</span>
<span class="token comment">// &quot;vue.css&quot;</span>
</pre></li>
<li>&#x4EE3;&#x7801;&#x5757;&#x6837;&#x5F0F;<pre data-role="codeBlock" data-info="javascript" class="language-javascript">codeBlockTheme<span class="token punctuation">:</span> <span class="token string">&apos;auto.css&apos;</span><span class="token punctuation">,</span>
<span class="token comment">//  &quot;auto.css&quot;,</span>
<span class="token comment">//  &quot;default.css&quot;,</span>
<span class="token comment">//  &quot;atom-dark.css&quot;,</span>
<span class="token comment">//  &quot;atom-light.css&quot;,</span>
<span class="token comment">//  &quot;atom-material.css&quot;,</span>
<span class="token comment">//  &quot;coy.css&quot;,</span>
<span class="token comment">//  &quot;darcula.css&quot;,</span>
<span class="token comment">//  &quot;dark.css&quot;,</span>
<span class="token comment">//  &quot;funky.css&quot;,</span>
<span class="token comment">//  &quot;github.css&quot;,</span>
<span class="token comment">//  &quot;hopscotch.css&quot;,</span>
<span class="token comment">//  &quot;monokai.css&quot;,</span>
<span class="token comment">//  &quot;okaidia.css&quot;,</span>
<span class="token comment">//  &quot;one-dark.css&quot;,</span>
<span class="token comment">//  &quot;one-light.css&quot;,</span>
<span class="token comment">//  &quot;pen-paper-coffee.css&quot;,</span>
<span class="token comment">//  &quot;pojoaque.css&quot;,</span>
<span class="token comment">//  &quot;solarized-dark.css&quot;,</span>
<span class="token comment">//  &quot;solarized-light.css&quot;,</span>
<span class="token comment">//  &quot;twilight.css&quot;,</span>
<span class="token comment">//  &quot;vue.css&quot;</span>
<span class="token comment">//  &quot;vs.css&quot;,</span>
<span class="token comment">//  &quot;xonokai.css&quot;</span>
</pre><ul>
<li>&#x51E0;&#x4E2A;&#x6837;&#x4F8B;<br>
<img src="/images/mume-demo1.png" alt="&#x6837;&#x4F8B;"><br>
<img src="/images/mume-demo2.png" alt="&#x6837;&#x4F8B;"><br>
<img src="/images/mume-demo3.png" alt="&#x6837;&#x4F8B;"><br>
<img src="/images/mume-demo4.png" alt="&#x6837;&#x4F8B;"><br>
<img src="/images/mume-demo5.png" alt="&#x6837;&#x4F8B;"></li>
</ul>
</li>
</ul>
<h4>&#x652F;&#x6301;&#x6570;&#x5B66;&#x516C;&#x5F0F;&#x6E32;&#x67D3;</h4>
<ul>
<li>KaTeX&#x6E32;&#x67D3;&#x5E93;</li>
<li>MathJax&#x6E32;&#x67D3;&#x5E93;</li>
</ul>
<h4>&#x5BFC;&#x51FA;&#x4EE3;&#x7801;&#x6613;&#x7528;</h4>
<p>MUME&#x5BFC;&#x51FA;&#x7684;html&#x4EE3;&#x7801;&#x7ED3;&#x6784;&#x6E05;&#x6670;&#xFF0C;&#x4FBF;&#x4E8E;&#x4FEE;&#x6539;&#x518D;&#x5229;&#x7528;<br>
<img src="/images/mume-htmlcode.png" alt="&#x4EE3;&#x7801;&#x6837;&#x4F8B;"></p>
<h3>&#x5176;&#x4ED6;</h3>
<p>&#x66F4;&#x591A;&#x529F;&#x80FD;&#x8BF7;&#x89C1;<a href="https://github.com/shd101wyy/mume">&#x5B98;&#x65B9;GitHub&#x5E93;</a>&#x8BF4;&#x660E;</p>

      